package com.milhouz.findmydroid.util;

import java.util.List;

import android.app.Activity;

import com.milhouz.findmydroid.R;
import com.milhouz.findmydroid.bean.Game;
import com.milhouz.findmydroid.bean.Team;

public class StringUtils {

	private StringUtils() {
	}

	/** Return a string with the team and score formated */
	public static String displayTeamScore(final Activity activity, final Team team) {
		return activity.getString(R.string.team_score, team.getTeamNumber(), team.getNbPoints());
	}

	/** Return a string for all teams (with score) formated */
	public static String displayTeamsScore(final Activity activity, final List<Team> teams) {
		StringBuilder sb = new StringBuilder();
		Team team = null;
		for (int i = 0; i < teams.size(); i++) {
			team = teams.get(i);
			sb.append(activity.getString(R.string.team_score, team.getTeamNumber(), team.getNbPoints()));
			if (i != (teams.size() - 1)) {
				sb.append("\n\n");
			}
		}
		return sb.toString();
	}

	public static String displayGameMode(final Activity activity, final Game.GameMode gameMode) {
		switch (gameMode) {
		case DESCRIBE_MODE:
			return activity.getString(R.string.dialog_nextphase_message_describe);
		case ONEWORD_MODE:
			return activity.getString(R.string.dialog_nextphase_message_oneword);
		case MIME_MODE:
			return activity.getString(R.string.dialog_nextphase_message_mime);
		}
		return "unknown";
	}

}
